home *** CD-ROM | disk | FTP | other *** search
/ TeX 1995 July / TeX CD-ROM July 1995 (Disc 1)(Walnut Creek)(1995).ISO / graphics / pstricks / doc / fancybox.doc (.txt) < prev    next >
LaTeX Document  |  1993-04-07  |  44KB  |  1,090 lines

  1. %% BEGIN fancybox.doc
  2. %% COPYRIGHT 1992, by Timothy Van Zandt, tvz@Princeton.EDU.
  3. %% For copying restrictions, see fancybox.sty.
  4. %% Documentation for fancybox.sty.
  5. %% Run through LaTeX, with or without the NFSS.
  6. \def\FileVersion{1.0}
  7. \def\FileDate{93/02/10}
  8. %% This creates two temporary files: \jobname.ex1 and \jobname.tmp
  9. \documentstyle[12pt]{article}
  10. \makeatletter
  11. %% INPUT FANCYBOX.STY HERE TO CHECK FILE VERSION.
  12. \input fancybox.sty
  13. \ifx\FileVersion\fileversion\else
  14.   \@latexerr{Fancybox style file and documentation do not have the same
  15.     version}\@ehd
  16. %% DATES, VERSIONS AND TITLES:
  17. \def\expanddate#1/#2/#3/{\year=19#1 \month=#2 \day=#3}
  18. \begingroup
  19.   \expandafter\expanddate\filedate/
  20.   \xdef\thefiledate{\today}
  21. \endgroup
  22. \title{Documentation for fancybox.sty:\\
  23.   Box tips and tricks for \LaTeX}
  24. \author{Timothy Van Zandt\\ tvz@Princeton.EDU}
  25. \date{Version \fileversion\\ \thefiledate}
  26. \def\@maketitle{%
  27.  \begin{center}
  28.    {\Large\bf \@title \par}
  29.    \vskip 1.2em {\lineskip .5em
  30.    \begin{tabular}[t]{c}\@author\end{tabular}\par}
  31.    \vskip .8em {\@date}%
  32.   \end{center}
  33.   \par
  34.   \vskip .5em}
  35. %% PAGE STYLE:
  36. \pagestyle{myheadings}
  37. \if@twoside
  38.   \markboth{Documentation for fancybox.sty}%
  39.     {Version \fileversion, \thefiledate}%
  40. \else
  41.   \markright{fancybox.sty, Version \fileversion}
  42. %% PAGE PARAMETERS:
  43. % Paragraphs are marked by large space rather than indentation:
  44. \parindent 0pt
  45. \parskip 7pt plus 1pt minus 1pt
  46. \setlength{\topmargin}{0pt}
  47. \setlength{\headheight}{12pt}        % height of running head
  48. \setlength{\headsep}{30pt}           % distance between header and text
  49. \setlength{\textheight}{8.2in}        % height of text on page
  50. %% TABLE OF CONTENTS
  51. \newskip\myskip
  52. \def\tableofcontents{%
  53.   \par\vfill
  54.   \begin{quote}
  55.     \begin{center} \Large\bf Contents \end{center}
  56.     \def\numberline##1{\hbox to 0pt{\hss##1\hskip 1em}}%
  57.     \let\oldaddvspace\addvspace
  58.     \def\addvspace##1{%
  59.       \myskip##1\relax
  60.       \oldaddvspace{.5\myskip}}
  61.     \@starttoc{toc}%
  62.   \end{quote}
  63.   \thispagestyle{empty}
  64.   \vfill
  65.   \clearpage}
  66. %% VERBATIM HACKS:
  67. \VerbatimFootnotes
  68. % Short meta (works in verbatim. Can't use < for other purposes.
  69. \catcode`\<=13 \def<#1>{{\rm\it #1\/}}    % <meta> (works in verbatim)
  70. % Short verbatim. " can appear in verbatim environments.
  71. \def\temp{\Verb"}
  72. \expandafter\def\expandafter\dospecials\expandafter{\dospecials\do\"}
  73. \catcode`\"=13
  74. \let"\temp
  75. % Verbatim item:
  76. \newcommand{\vitem}{\SaveVerb[{\def\bf{}\item[\UseVerb{\MyTemp}]}]{\MyTemp}}
  77. %% EXAMPLES:
  78. \setlength{\fboxsep}{6pt}
  79. \begin{VerbatimOut}{\jobname.ex1}
  80. % 1. Save example verbatim to \jobname.tmp,
  81. % 2. Input verbatim with \catcode`\"=14 (" is a comment).
  82. % 3. Input again with \catcode\`"=9 (" is ignored).
  83. \renewcommand{\EveryVerbatimLine}[2]{}
  84. \renewcommand{\EveryVerbOutLine}[2]{}
  85. \newcommand{\BeginExample}{%
  86.   \VerbatimEnvironment\begin{VerbatimOut}{\jobname.tmp}}
  87. \newcommand{\EndExample}{%
  88.   \end{VerbatimOut}%.
  89.   \renewcommand{\EveryVerbatimLine}{}%
  90.   \renewcommand{\EveryVerbatimCodes}{\catcode`\"=14}%
  91.   \LVerbatimInput{\jobname.tmp}%
  92.   \catcode`\"=9}
  93. \newenvironment{example}{\BeginExample}{\EndExample
  94.   \begin{center}\input{\jobname.tmp}\end{center}}
  95. \newenvironment{example*}{\BeginExample}%
  96.   {\EndExample \input{\jobname.tmp}}
  97. \newenvironment{example**}{\BeginExample}%
  98.   {\EndExample \globaldefs=1 \input{\jobname.tmp}}
  99. \end{VerbatimOut}
  100. \input{\jobname.ex1}
  101. %% END PREAMBLE:
  102. \makeatother
  103. \begin{document}
  104. \setcounter{page}{0}
  105. \maketitle
  106. \begin{quote}
  107. "fancybox.sty", together with its documentation, gives extensive answers to
  108. and solutions for many questions about how to frame or rotate this or that in
  109. \LaTeX. It also contains commands for shadow, double and oval frames.
  110. \end{quote}
  111. \tableofcontents
  112. \section{Fancy frames}
  113. "fancybox.sty" has five variants of \LaTeX's "\fbox" command:
  114. \begin{quote}\raggedright
  115. "\shadowbox", "\doublebox", "\ovalbox" (with "\thinlines") and "\Ovalbox"
  116. (with "\thicklines").
  117. \end{quote}
  118. Here are examples:\footnote{In this documentation, the default value of
  119. "\fboxsep" has been changed from 3pt to 6pt.}
  120. \begin{example}
  121.   \shadowbox{\large\bf New Glarus Birdwatch}
  122. \end{example}
  123. \begin{example}
  124.   \doublebox{\large\bf New Glarus Birdwatch}
  125. \end{example}
  126. \begin{example}
  127.   \ovalbox{\large\bf New Glarus Birdwatch}
  128. \end{example}
  129. \begin{example}
  130.   \Ovalbox{\large\bf New Glarus Birdwatch}
  131. \end{example}
  132. The distance between the box and the frame is "\fboxsep", as with \LaTeX's
  133. "\fbox" command. The commands use other parameters as well:
  134. \begin{description}
  135. \vitem"\shadowbox" The width of the frame is "\fboxrule" (the same as with
  136. "\fbox"). The width of the shadow is "\shadowsize" (default: "4pt").
  137. \vitem"\doublebox" The width of the inner frame is .75"\fboxrule", and the
  138. width of the outer frame is 1.5"\fboxrule". The distance between the two
  139. frames is 1.5"\fboxrule" plus .5pt.
  140. \vitem"\ovalbox" The width of the frame is set by the "\thinlines"
  141. declaration. The diameter of the corner arcs is set with the "\cornersize"
  142. command.
  143. \begin{LVerbatim}
  144.   \cornersize{<num>}
  145. \end{LVerbatim}
  146. sets the diameter of the corners arcs to <num> times the lessor of the width
  147. and height of the box.
  148. \begin{LVerbatim}
  149.   \cornersize*{<dim>}
  150. \end{LVerbatim}
  151. sets the diameter of the corner arcs to <dim>. This is all approximate,
  152. because \LaTeX\ has a limited range of arc sizes to choose from. The default
  153. \begin{LVerbatim}
  154.   \cornersize{.5}
  155. \end{LVerbatim}
  156. \vitem"\Ovalbox" This is like "\ovalbox", except that the width of the lines
  157. is set by the "\thicklines" declaration.
  158. \end{description}
  159. There are no analogs to \LaTeX's "\framebox" command, which has various
  160. optional arguments not supported by "\fbox". You can get the exact same
  161. functionality by putting the argument of the above framing commands in a
  162. "\makebox".
  163. There is also a variant "\fancyoval" of \LaTeX's "\oval" picture object. The
  164. difference is that "\oval" always makes the diameter of the corner arcs as
  165. large as possible, and "\fancyoval" uses the "\cornersize" command to set the
  166. diameter.
  167. \section{A short course on boxes}
  168. \begingroup\sloppy
  169. The "\shadowbox", "\doublebox", "\ovalbox" and "\Ovalbox" commands described
  170. in the previous section are examples of LR-box commands, meaning that their
  171. argument is processed in LR mode. \LaTeX\ LR-box commands include "\mbox",
  172. "\makebox", "\fbox", "\framebox", "\sbox" and "\savebox". All the PSTricks
  173. commands whose argument is text are LR-box commands, including, e.g, the
  174. framing, rotating, scaling and positioning commands, and some of the node
  175. commands. Any rotation command is an LR-box command.
  176. \endgroup
  177. The purpose of the rest of this documentation is to provide answers to, and
  178. solutions for, frequently asked questions about using LR-box commands with
  179. \LaTeX. I will use "\fbox" for the leading example of a box framing
  180. command,\footnote{In the examples using "\fbox", be aware that the default
  181. value of "\fboxsep" has been changed in this documentation from 3pt to 6pt.}
  182. and "\rotateleft" for the leading example of a box rotation command.
  183. ("fancybox.sty" does not contain a "\rotateleft" command, as this must be
  184. implemented via "\special"'s, but there are numerous box-rotation style files
  185. around.) However, most of what is said here applies to any LR-box command.
  186. In each LR-box command, the text is processed in restricted horizontal mode,
  187. which is referred to as ``LR-mode'' in Lamport's {\em \LaTeX: User's Guide and
  188. Reference Manual}. In restricted horizontal mode, the input, consisting of
  189. regular characters and boxes, is made into one (long or short) line. There is
  190. no line-breaking, nor can there be vertical mode material such as an entire
  191. displayed equation. However, the fact that you can include another box means
  192. that this isn't really a restriction.
  193. For one thing, alignment environments such as \LaTeX's "tabular" are just
  194. boxes, and thus present no problem. Picture environments and the LR-box
  195. commands themselves are also just boxes. Entire paragraphs or other vertical
  196. mode material such as displayed equations can be nested in a "\parbox" or
  197. "minipage".
  198. \section{Defining LR-box environments}
  199. To frame a "minipage", you have to write
  200. \begin{LVerbatim}
  201.   \fbox{%
  202.     \begin{minipage}{3in}
  203.       blah
  204.     \end{minipage}}
  205. \end{LVerbatim}
  206. You might want to define an environment "fminipage" that frames its contents,
  207. but you can't use
  208. \begin{LVerbatim}
  209.   \newenvironment{fminipage}%
  210.     {\fbox{\begin{minipage}}%
  211.     {\end{minipage}}}
  212. \end{LVerbatim}
  213. because the braces are not balanced in the definition.
  214. "fancybox.sty" contains an "Sbox" environment that makes it easy to define
  215. your own LR-box environments. It is a variant of \LaTeX's "\sbox" command that
  216. saves the contents of the environment in a storage bin that can be retrieved
  217. with the command "\TheSbox".\footnote{The difference between
  218. \begin{LVerbatim}
  219.   \begin{Sbox}
  220.     blah
  221.   \end{Sbox}
  222.   \TheSbox
  223. \end{LVerbatim}
  224. \begin{LVerbatim}
  225.   \newsavebox{\mybox}
  226.   \sbox{\mybox}{blah}
  227.   \usebox{\mybox}
  228. \end{LVerbatim}
  229. is that "Sbox" saves the contents globally, and "\TheSbox" erases the contents
  230. globally.}
  231. For example, here is a framed minipage:
  232. \begin{LVerbatim}
  233.   \begin{Sbox}
  234.     \begin{minipage}{3in}
  235.       blah
  236.     \end{minipage}
  237.   \end{Sbox}
  238.   \fbox{\TheSbox}
  239. \end{LVerbatim}
  240. and here is an "fminipage" environment that works:
  241. \begin{example**}
  242.   \newenvironment{fminipage}%
  243.     {\begin{Sbox}\begin{minipage}}%
  244.     {\end{minipage}\end{Sbox}\fbox{\TheSbox}}
  245. \end{example**}
  246. Let's see that it really works:
  247. \begin{example}
  248.   \begin{fminipage}{2in}
  249.     Since the former doesn't use braces to delimit
  250.     the contents of the box, $\ldots$
  251.   \end{fminipage}
  252. \end{example}
  253. \section{Math}
  254. In-line math, or pieces of a displayed equation (as opposed to a whole
  255. equation), are horizontal mode material, but most LR-box commands switch out
  256. of math mode when they occur in math mode. Thus, you have to explicitly switch
  257. back in to math mode when desired.\footnote{This is {\em not} true for the
  258. PSTricks LR-box commands.}
  259. For example:
  260. \begin{example}
  261.   $x + y = \fbox{$\Omega$}$
  262. \end{example}
  263. You also have to explicitly write
  264. \begin{quote}
  265.   "\scriptstyle", "\scriptscriptstyle" or "\displaystyle"
  266. \end{quote}
  267. if you want one of these special math styles. For example, here I will frame
  268. an equation, but not the equation number:
  269. \begin{example*}
  270.   \begin{equation}
  271.     \fbox{$\displaystyle
  272.       \int_{\Omega_0} \zeta(\omega) d\omega
  273.       \geq \bar{r}$}
  274.   \end{equation}
  275. \end{example*}
  276. Entire displayed equations or "eqnarray" environments work differently because
  277. they are vertical mode material. Thus, they have to go inside a "\parbox" or
  278. "minipage". E.g.,
  279. \begin{example*}
  280.   \newlength{\mylength}
  281.     \setlength{\fboxsep}{15pt}
  282.     \setlength{\mylength}{\linewidth}
  283.     \addtolength{\mylength}{-2\fboxsep}
  284.     \addtolength{\mylength}{-2\fboxrule}
  285.     \fbox{%
  286.       \parbox{\mylength}{
  287.         \setlength{\abovedisplayskip}{0pt}
  288.         \setlength{\belowdisplayskip}{0pt}
  289.         \begin{equation}
  290.           x + y = z
  291.         \end{equation}}}
  292. \end{example*}
  293. The outer "\[" "\]" are just used to display the boxed equation, rather than
  294. actually switch into math mode. Note how I set the width of the "\parbox" so
  295. that the displayed box would exactly have width "\linewidth".\footnote{That is
  296. what "\mylength" is for. It is better to define a single scratch length that
  297. you reuse rather than creating a new one each time.}
  298.  I also set the display skips to "0pt" and increased the size of "\fboxsep" so
  299. that I would have the same distance all around between the equation and the
  300. frame.
  301. This is again a mouthful, and so I might instead define:\footnote{The reason
  302. for using "\minipage" instead of "\begin{minipage}", and so on, is that with
  303. AmS-\LaTeX, "\begin" and "\end" cannot appear in the definition of a new
  304. equation environment.}
  305. \begin{example**}
  306.   \newenvironment{FramedEqn}%
  307.     {\setlength{\fboxsep}{15pt}
  308.       \setlength{\mylength}{\linewidth}%
  309.       \addtolength{\mylength}{-2\fboxsep}%
  310.       \addtolength{\mylength}{-2\fboxrule}%
  311.       \Sbox
  312.       \minipage{\mylength}%
  313.          \setlength{\abovedisplayskip}{0pt}%
  314.          \setlength{\belowdisplayskip}{0pt}%
  315.          \equation}%
  316.     {\endequation\endminipage\endSbox
  317.       \[\fbox{\TheSbox}\]}
  318. \end{example**}
  319. "fancybox.sty" doesn't bother defining any such environments, because there
  320. are too many possible designs. But let's see if the one above works:
  321. \begin{example*}
  322.   \begin{FramedEqn}
  323.     \Rightarrow P\sim\xi(P_\gamma)- \frac{1}{3}
  324.   \end{FramedEqn}
  325. \end{example*}
  326. "fancybox.sty" contains a "Beqnarray" environment, which is like the
  327. "eqnarray" environment but it is not vertical mode material. Instead, it
  328. produces a box just large enough to hold all the equations. For example:
  329. \begin{example}
  330.   \fbox{%
  331.     \begin{Beqnarray*}
  332.       x & = & y\\
  333.       y & > & x \\
  334.       \int_4^5 f(x)dx & = & \sum_{i\in F} x_i
  335.     \end{Beqnarray*}}
  336. \end{example}
  337. The unstarred version produces standard equation numbers on the right (even
  338. with the "leqno" style option and AmS-\LaTeX). It might not work with special
  339. equation numbering macros.
  340. \section{Floats}\label{floats}
  341. A common mistake is to put a whole "table", "figure" or other float
  342. environment inside an LR-box command. Instead, you should put everything that
  343. is {\em inside} the environment (including the "\caption", if you want that
  344. boxed too) inside a "minipage" of the desired width, and then put the
  345. "minipage" inside the LR-box command.
  346. For example:
  347. \begin{example*}
  348.   \begin{table}[h]
  349.     \begin{center}
  350.       \fbox{%
  351.         \begin{minipage}{.8\textwidth}
  352.           \begin{center}
  353.             \begin{tabular}{rl}
  354.               foo & bar
  355.             \end{tabular}
  356.           \end{center}
  357.           \caption{A table of foo and bar.}
  358.         \end{minipage}}
  359.     \end{center}
  360.   \end{table}
  361. \end{example*}
  362. Note how I had to use "center" twice: once to center the framed box, and again
  363. to center the stuff inside the box.
  364. That is a mouthful, and so I might define a "FramedTable" environment like the
  365. following, which sets the size of the "minipage" so that the framed box is
  366. exactly the width of the page (no need for the first "center" environment this
  367. time):
  368. \begin{example**}
  369.   \newenvironment{FramedTable}%
  370.     {\begin{table}[h]
  371.       \begin{Sbox}%
  372.       \setlength{\mylength}{\textwidth}%
  373.       \addtolength{\mylength}{-2\fboxsep}%
  374.       \addtolength{\mylength}{-2\fboxrule}%
  375.       \begin{minipage}{\mylength}}%
  376.     {\end{minipage}\end{Sbox}\fbox{\TheSbox}\end{table}}%
  377. \end{example**}
  378. Now let's see if it works:
  379. \begin{example*}
  380.   \begin{FramedTable}
  381.     \begin{center}
  382.       \begin{tabular}{rl}
  383.         foo & bar
  384.       \end{tabular}
  385.     \end{center}
  386.     \caption{A table of foo and bar.}
  387.   \end{FramedTable}
  388. \end{example*}
  389. The most common reason to want to rotate an entire float, caption and all, is
  390. to put it on a page by itself in landscape mode, centered both horizontally
  391. and vertically. Compared to the table framing we did above, we just have to
  392. replace "\fbox" by our box rotation command (e.g., "\rotateleft" or whatever),
  393. set the width of the minipage to "\textheight" (if you want to use the full
  394. size of the page), and use the float position specifier "[p]". "fancybox.sty"
  395. contains an environment,
  396. \begin{LVerbatim}
  397.   \begin{landfloat}{<float>}{<rotation command>}
  398.     ...
  399.   \end{landfloat}
  400. \end{LVerbatim}
  401. that automates this. It has two arguments: the name of the floating
  402. environment, and your rotation command. For example, if "\rotateleft{foo}"
  403. rotates "foo" by 90 degrees, and you want a landscape mode "table", then try
  404. \begin{LVerbatim}
  405.   \begin{landfloat}{table}{\rotateleft}
  406.     ...
  407.   \end{landfloat}
  408. \end{LVerbatim}
  409. If the whole document is in landscape mode, then "landfloat" gives you a
  410. portrait-mode float---good for a table that is too tall to fit in landscape
  411. mode.
  412. If you don't add a caption to a float, it doesn't matter much what floating
  413. environment you use (e.g., "table", "figure" or whatever). Thus, you can put
  414. anything in a landscape float. For example, suppose I have a very wide
  415. equation. Then I can write:
  416. \begin{LVerbatim}
  417.   \begin{landfloat}{table}{\rotateleft}
  418.     \begin{equation}
  419.       ...
  420.     \end{equation}
  421.   \end{landfloat}
  422. \end{LVerbatim}
  423. "fancybox.sty" defines a generic caption, "\GenericCaption", that doesn't
  424. affect the numbering of floats, doesn't make an entry in a list of floats, and
  425. doesn't add anything to the argument you give. I could have used this if I
  426. wanted to add a caption to the previous example.
  427. \section{Center, flushleft and flushright}
  428. There are two ways to box a "center", "flushleft" or "flushright" environment.
  429. If you have long lines and you want \TeX\ to do the line breaking, then put
  430. the environment inside a "minipage".\footnote{List and other such environments
  431. work best inside a "minipage" environment rather than a "\parbox".} If you
  432. have short lines and you want the frame to adjust itself to the size of the
  433. longest line, then use "fancybox.sty"'s
  434. \begin{quote}
  435.   "Bcenter", "Bflushleft" or "Bflushright"
  436. \end{quote}
  437. environment instead.
  438. These are basically just "tabular" environments with a single column, and so
  439. each line should end with "\\", or "\\["<dim>"]" to insert extra space, and
  440. the text on each line must be balanced. Also, each line is sitting in its own
  441. group, and so, e.g., if you want to change the font for the whole environment,
  442. you should do this before the environment rather than after.
  443. Like the "tabular" environment, the box that is produced has the baseline at
  444. the center, unless you include an optional argument "[t]" to align the box
  445. with the top line or "[b]" to align the box with the bottom line.
  446. For example:
  447. \begin{example}
  448.   \setlength{\fboxsep}{10pt}%
  449.   \fbox{%
  450.     \begin{Bcenter}
  451.       Love of life\\
  452.       and other short stories\\
  453.       by Policarpa Salabarrieta
  454.   \end{Bcenter}}
  455. \end{example}
  456. Compare this with:
  457. \begin{example}
  458.   \setlength{\fboxsep}{10pt}%
  459.   \fbox{%
  460.     \begin{minipage}{6cm}
  461.     \begin{center}
  462.       Love of life and other short stories
  463.       by Policarpa Salabarrieta
  464.     \end{center}
  465.     \end{minipage}}
  466. \end{example}
  467. In either case, if we want the resulting framed box centered, we have to
  468. include it inside another "center" environment.
  469. Here is another example:
  470. \begin{example}
  471.   My list: \fbox{%
  472.     \begin{Bflushleft}[b]
  473.       Galanga root\\
  474.       Coconut\\
  475.       Tempeh
  476.     \end{Bflushleft}}
  477. \end{example}
  478. \section{Lists}
  479. There are again two ways to box a list environment such as
  480. \begin{quote}
  481.   "itemize", "enumerate" or "description".
  482. \end{quote}
  483. You can put it in a "minipage" of pre-determined size and let \TeX\ do the
  484. line breaking, or you can use
  485. \begin{quote}
  486.   "Bitemize", "Benumerate" or "Bdescription"
  487. \end{quote}
  488. instead, and let the box adjust to the size of the longest line.
  489. For example.
  490. \begin{example}
  491.   \fbox{%
  492.     \begin{Bitemize}
  493.       \item Groceries
  494.       \item Clean hamster cages
  495.       \item Pick up Peter
  496.     \end{Bitemize}}
  497. \end{example}
  498.  Most of the usual list parameters are irrelevant except for "\itemsep" and
  499. "\labelsep". These environments are also based on the "tabular" environment,
  500. and so each item should be balanced text. You can't write "\vspace{4pt}"
  501. either, but you can insert an extra amount of space before an item by writing
  502. "\item(4pt)" (or "\item(4pt)[label]" if you have a label). Also, you can break
  503. lines within an item using "\\" or "\\[<dim>]". For example:
  504. \begin{example}
  505.   \fbox{%
  506.     \begin{Bdescription}
  507.       \item[David] Groceries
  508.       \item[Eli]  Hamster cages\\
  509.                   Surreal numbers
  510.       \item(3pt)[Doris] Pick up Peter
  511.     \end{Bdescription}}
  512. \end{example}
  513. These environments also have an optional argument, "[t]" to align the box with
  514. the top line, and "[b]" to align the box with the bottom line.
  515. \begin{example}
  516.   To do:
  517.   \fbox{\setlength{\itemsep}{0pt}%
  518.     \begin{Benumerate}[t]
  519.       \item Groceries
  520.       \item Hamster cages
  521.       \item Pick up Peter
  522.     \end{Benumerate}}
  523. \end{example}
  524. There is also a generic "\Blist" command that is analogous to \LaTeX's
  525. "\list".  It has the same two obligatory arguments, plus a third optional
  526. "[t]" or "[b]" argument for changing the alignment.
  527. \section{Superimposing boxes}
  528. The command
  529. \begin{LVerbatim}
  530.   \boxput*(<x>,<y>){<LR stuff1>}{<LR stuff2>}
  531. \end{LVerbatim}
  532. puts <LR stuff1> either behind (the default) or in front of (with the "*") <LR
  533. stuff2>.\footnote{You will only notice the difference between "\boxput" and
  534. "\boxput*" if you are using color implemented by "\special"'s} The resulting
  535. box has the dimensions of <LR stuff2>.
  536. The coordinates "(<x>,<y>)" determine where the center of <LR stuff1> is
  537. positioned. For example, "(0,0)" puts it at the center of <LR stuff2>, "(0,1)"
  538. puts it at the center-top, and "(-1,-1)" puts it in the bottom-left corner.
  539. More generally, the origin of the coordinate system is at the center of <LR
  540. stuff2>, one unit in the vertical direction is half the vertical size of <LR
  541. stuff2>, and one unit in the horizontal direction is half the width of <LR
  542. stuff2>. Thus, <x> and <y> should always be numbers (without units such as
  543. "pt" or "cm"), with one exception: If <y> is "b" or "B", <LR stuff1> is
  544. positioned vertically at the baseline of <LR stuff2>. "(<x>,<y>)" is
  545. optional---the default is "(0,0)".
  546. Except for the funny coordinate system, "\boxput" is like the "\put" command
  547. in a "picture". In particular, you can use "\makebox" in <LR stuff1> to
  548. fine-tune the positioning, and <LR-stuff1> can contain a "picture"
  549. environment.
  550. You might use "\boxput" to put a ``water mark'' in the background of a box, or
  551. to put a label next to a box, when you don't want this label to take up any
  552. space. Here is a lazy example:
  553. \begin{example}
  554.   \boxput{\makebox(0,0){\Huge Censored!}}{\parbox{3in}{%
  555.     The origin of the coordinate system is at the center of
  556.     {\em LR stuff2}, and one unit in the x-direction
  557.     is half the width of {\em LR stuff2}.}}
  558. \end{example}
  559. This would be a lot more interesting using PSTricks, with ``Censored!'' in the
  560. foreground, rotated 30 degrees, and red:
  561. \begin{LVerbatim}
  562.   \boxput*{\rput{30}{\Huge\red Censored}}{\parbox{3in}{%
  563.     blah blah}}
  564. \end{LVerbatim}
  565. Here is another example using PSTricks:
  566. \begin{LVerbatim}
  567.   \newcommand{\titledframe}[2]{%
  568.     \boxput*(0,1){\psframebox*{#1}}%
  569.       {\psframebox[framesep=12pt]{#2}}}
  570. \end{LVerbatim}
  571. \newcommand{\titledframe}[2]{%
  572.   \boxput*(0,1){#1}%
  573.     {\fboxsep=12pt \fbox{#2}}}
  574. The following example illustrated roughly how it works, but ``My title'' does
  575. not blot out the frame behind it because this documentation does not use
  576. PSTricks. \begin{example}
  577.   \titledframe{My title}{%
  578.     \parbox{2in}{The title is superimposed
  579.       on the top part of the frame.}}
  580. \end{example}
  581. \section{Framing a whole page}
  582. The commands
  583. \begin{LVerbatim}
  584.   \fancyput*(<x>,<y>){<LR stuff>}
  585.   \thisfancyput*(<x>,<y>){<LR stuff>}
  586. \end{LVerbatim}
  587. are pretty much like "\put" commands in a \LaTeX\ picture environment whose
  588. origin is 1 inch down and to the right from the top left corner of the
  589. page.\footnote{Don't blame me for \TeX's peculiar 1 inch margins.} The only
  590. differences are that (i) that any LR-mode material is permitted (including
  591. \LaTeX\ "picture" environment, of course), (ii) the coordinate is optional
  592. "(0pt,0pt)" is substituted by default), and (iii) if the coordinate is
  593. included, you {\em must} specify the units.
  594. "\thisfancyput" affects only the current page, and is a global declaration
  595. (analogous to "\thispagestyle").
  596. If you include the optional "*", then the command adds to, rather than
  597. replaces, other things that have been inserted with "\fancyput" or
  598. "\thisfancyput".
  599. These commands are particularly useful for framing a page, because you can get
  600. a frame that is, e.g., 1 inch from each side of the physical page without
  601. having to worry about what margins you are using for the document. Here is an
  602. example:
  603. \begin{example*}
  604.   \thisfancyput(3.25in,-4.5in){%
  605.     \setlength{\unitlength}{1in}\fancyoval(7,9.5)}
  606. \end{example*}
  607. You could also use "\fancyput" to add some kind of ``watermark'' or background
  608. image (e.g., a light gray ``DRAFT'').
  609. There are other commands that directly frame or in some other way box the page
  610. of text:
  611. \begin{LVerbatim}
  612.   \fancypage{<cmds1>}{<cmds2>}
  613.   \thisfancypage{<cmds1>}{<cmds2>}
  614. \end{LVerbatim}
  615. Each finished page, before adding the headers and footers, (and thus having
  616. width and height "\textwidth" and "\textheight", is boxed with
  617. \begin{LVerbatim}
  618.   <cmds1>{<pagebox>}
  619. \end{LVerbatim}
  620. Thus, <cmds1> should be, or should end with, a command whose argument can be a
  621. box, such as "\fbox" or "\rotateleft".
  622. Then the headers and footers are added, using the new width of the page, and
  623. this is boxed with
  624. \begin{LVerbatim}
  625.   <cmds2>{<pagebox>}
  626. \end{LVerbatim}
  627. The same rules apply to <cmds2> as to <cmds1>.
  628. Here is an example:
  629. \begin{example*}
  630.   \thisfancypage{%
  631.     \setlength{\fboxsep}{8pt}%
  632.     \setlength{\shadowsize}{8pt}%
  633.     \shadowbox}{}
  634. \end{example*}
  635. {\bf Warning:} The commands described in this section change \LaTeX's output
  636. routine, and may not work with document styles that do the same. Also, bad
  637. arguments can cause serious errors with uninformative error messages.
  638. \section{Switching to landscape mode midstream}
  639. The most common reason to switch to landscape mode midstream is to rotate a
  640. float, such as a table or figure. This was discussed in Section \ref{floats}.
  641. If you want to rotate one or more pages, without rotating the headers and
  642. footers, use the
  643. \begin{LVerbatim}
  644.   \begin{LandScape}{<cmd>}
  645.     ...
  646.   \end{LandScape}
  647. \end{LVerbatim}
  648. environment. <cmd> should be the command for rotating the page 90 degrees to
  649. the left or right. (E.g., "\rotateleft", or "\rotate[l]".)
  650. If you want to rotate the headers, footers and margins as well, use the
  651. \begin{LVerbatim}
  652.   \begin{Landscape}{<paperwidth>}{<paperheight>}{<cmd>}
  653.     ...
  654.   \end{Landscape}
  655. \end{LVerbatim}
  656. environment (the small "s" makes the difference) to rotate the pages left
  657. (counterclockwise), and use the "Landscape*" environment (same arguments) to
  658. rotate the pages right (clockwise). The three arguments are the width of the
  659. paper, the height of the paper, and the rotation command you are using. For
  660. example, if I have a portrait mode document using the US 8.5in by 11in paper,
  661. and if "\rotateleft{foo}" rotates "foo" 90 degrees counterclockwise, then I
  662. can write
  663. \begin{LVerbatim}
  664.   \begin{Landscape}{8.5in}{11in}{\rotateleft}
  665. \end{LVerbatim}
  666. You can use "\LandScape", "\Landscape" and "\Landscape*", rather then the
  667. "LandScape", "Landscape" and "Landscape*" environments, if you want the rest
  668. of the document to be in landscape mode.
  669. If your document is being printed in landscape mode, then these environments 
  670. switch to portrait mode.
  671. For example, suppose I have a landscape mode document, and I want to switch to
  672. portrait mode for the rest of the document, rotating the pages to the
  673. ``right'' with "\rotateright". Then I would write
  674. \begin{LVerbatim}
  675.   \Landscape*{11in}{8.5in}{\rotateright}
  676. \end{LVerbatim}
  677. These environments switch the text width and height, leaving the margins
  678. exactly as they were before. It is quite possible that you want to make other
  679. changes to the page parameters after switching to landscape mode, but as
  680. Lamport points out the \LaTeX\ {\em User's Guide and Reference Manual}, this
  681. generally doesn't work right in the middle of the document. "fancybox.sty" has
  682. a command "\UsePageParameters" which gets around this. It should be used right
  683. after you change the page parameters (and the page parameter changes should
  684. come right after the beginning of the landscape environment, or "\clearpage").
  685. {\bf Warning:} The commands and environments described in this section change
  686. \LaTeX's output routine, and may not work with document styles that do the
  687. same. Also, bad arguments can cause serious errors with uninformative error
  688. messages.
  689. \section{Verbatim}
  690. If you try to frame some verbatim text by typing
  691. \begin{LVerbatim}
  692.   \fbox{%
  693.     \begin{minipage}{5cm}
  694.       \begin{verbatim}
  695.         \My \Program \Listing
  696.         if { foo } { bar } fi
  697.       \end{verbatim}
  698.     \end{minipage}}
  699. \end{LVerbatim}
  700. you will get nonsense at best. This is because the argument to "\fbox" is read
  701. before the "\begin{verbatim}" is processed. But then it is too late for \TeX\
  702. to go back and interpret the contents of the verbatim environment literally
  703. rather than as special \TeX\ commands and characters.
  704. One solution is to use the "Sbox" environment:
  705. \begin{example}
  706.   \begin{Sbox}
  707.   \begin{minipage}{5cm}
  708.   \begin{verbatim}
  709.   \My \Program \Listing
  710.   if { foo } { bar } fi
  711.   \end{verbatim}
  712.   \end{minipage}
  713.   \end{Sbox}
  714.   \setlength{\fboxsep}{8pt}
  715.   \fbox{\TheSbox}
  716. \end{example}
  717. "fancybox.sty" also contains a command that ``fixes'' \LaTeX's LR-box commands
  718. for use with verbatim text:
  719. \begin{LVerbatim}
  720.   \VerbBox{<cmd>}{<LR stuff>}
  721. \end{LVerbatim}
  722. This is like
  723. \begin{LVerbatim}
  724.   <cmd>{<LR stuff>}
  725. \end{LVerbatim}
  726. but <LR stuff> can contain verbatim text.\footnote{Or other tricks that
  727. involve "\catcode" changes, as occurs with some foreign language macros.} For
  728. example:
  729. \begin{example}
  730.   \VerbBox{\fbox}{\verb+\foo{bar}+}
  731. \end{example}
  732. For footnotes, put the command "\VerbatimFootnotes" in the preamble, and then
  733. you can use verbatim commands or environments in the argument of "\footnote".
  734. This is an optional feature because it might conflict with somebody else's
  735. modification of the footnote system.
  736. If you try to define your own framed verbatim environment with
  737. \begin{LVerbatim}
  738.   \newenvironment{FramedVerb}%
  739.     {\begin{Sbox}\begin{minipage}{5in}\begin{verbatim}}
  740.     {\end{verbatim}\end{minipage}\end{Sbox}
  741.       \setlength{\fboxsep}{8pt}\fbox{\TheSbox}}
  742. \end{LVerbatim}
  743. and then type
  744. \begin{LVerbatim}
  745.   \begin{FramedVerb}
  746.     if { foo } { bar } fi
  747.   \end{FramedVerb}
  748. \end{LVerbatim}
  749. you will again run into trouble because after the "\begin{verbatim}", \LaTeX\
  750. is searching for the literal string "\end{verbatim}" as the end of the
  751. verbatim text. It just skips right over the "\end{FramedVerb}" and may well
  752. continue to the end of the file or until it throws up.
  753. "fancybox.sty" contains some verbatim environments that get around this
  754. problem and that have other advantages for LR-boxing verbatim listings, when
  755. compared to the standard \LaTeX\ "verbatim" environment. Admittedly, many of
  756. their special features have nothing to do with boxes.
  757. Here are the basic verbatim environments:
  758. \begin{description}
  759.   \vitem"Verbatim" Works pretty much like \LaTeX's "verbatim".
  760.   \vitem"LVerbatim" Like "Verbatim", but "list" rather than "trivlist" is used
  761. to display the listing, and so it is indented from the left margin. (This is
  762. what I am using for verbatim listings in this document.)
  763.   \vitem"BVerbatim[<pos>]" Produces a box with the same width as the longest
  764. verbatim line. The baseline is in the center, unless you include the optional
  765. argument "[t]" for alignment with the top line or "[b]" for alignment with the
  766. bottom line.
  767.   \vitem"VerbatimOut{<file>}" Writes the verbatim text to <file>.
  768.   \vitem"SaveVerbatim{<cmd>}" Saves the verbatim text as <cmd>. <cmd> is
  769. defined globally, without checking whether <cmd> is already defined. Use
  770. obviously innocuous names like "\MyTemp".
  771. \end{description}
  772. {\bf Important:} For any of these verbatim environments, or new verbatim
  773. environments you define yourself (see below), nothing should come after
  774. "\begin{Verbatim}" or before "\end{Verbatim}" on the same line --- not even
  775. spaces!%
  776.   \footnote{If you need to allow something to come before "\end{Verbatim}",
  777. then you have two options:
  778.   \begin{itemize}
  779.   \item Put the command "\AltGetVerbatim" in the preamble. This switches to a
  780. scheme where anything preceding "\end{Verbatim}" is simply ignored. This can
  781. cause problems if you do really weird things with active characters or other
  782. commands within the verbatim environment (e.g., active conditionals that are
  783. not balanced within a line of verbatim text), but in this case you are
  784. probably a good enough hacker to use the next option.
  785.   \item "\EndVerbatimTokens" is a token register that you can set to the
  786. tokens that should precede "\end{Verbatim}" on the same line, with their
  787. verbatim "\catcode"'s.
  788.   \end{itemize}}
  789. If you put something after "\begin{Verbatim}" on the same line, it is simply
  790. ignored. However, if you put something after "\end{Verbatim}" on the same
  791. line, or if you misspell "\end{Verbatim}", you will get an error such as
  792. \begin{LVerbatim}
  793.   ! File ended while scanning use of \Verbatim.
  794. \end{LVerbatim}
  795. and the document will end at that point.
  796. You can define new verbatim environments using "\newenvironment". You just
  797. have to start the definition with
  798. \begin{LVerbatim}
  799.   \VerbatimEnvironment
  800. \end{LVerbatim}
  801.  For example, here is the framed verbatim environment we tried earlier:
  802. \begin{example**}
  803.   \newenvironment{FramedVerb}%
  804.     {\VerbatimEnvironment
  805.       \begin{Sbox}\begin{minipage}{5cm}\begin{Verbatim}}%
  806.     {\end{Verbatim}\end{minipage}\end{Sbox}
  807.       \setlength{\fboxsep}{8pt}\fbox{\TheSbox}}
  808. \end{example**}
  809. Let's give it a try:
  810. \begin{example}
  811.   \begin{FramedVerb}
  812.   if { foo } { bar } fi
  813.   \end{FramedVerb}
  814. \end{example}
  815. Here are three commands for inputting a whole file verbatim. The file must end
  816. with a new line.
  817. \begin{description}
  818.   \vitem"\VerbatimInput{<file>}" Like "\Verbatim".
  819.   \vitem"\LVerbatimInput{<file>}" Like "\LVerbatim".
  820.   \vitem"\BVerbatimInput[<pos>]{<file>}" Like "\BVerbatim".
  821. \end{description}
  822. Here are three commands for making use of verbatim text that has been saved to
  823. a command:
  824. \begin{description}
  825.   \vitem"\UseVerbatim{<cmd>}" Like "\Verbatim".
  826.   \vitem"\LUseVerbatim{<cmd>}" Like "\LVerbatim".
  827.   \vitem"\BUseVerbatim[<pos>]{<cmd>}" Like "\BVerbatim".
  828. \end{description}
  829. The "SaveVerbatim" environment and the "\UseVerbatim" commands are useful for 
  830. including verbatim text in the argument of "\marginpar", "\fbox" and other
  831. commands. For example, here is another way to define the "FramedVerb"
  832. environment:
  833. \begin{LVerbatim}
  834.   \newenvironment{FramedVerb}%
  835.     {\VerbatimEnvironment
  836.       \begin{SaveVerbatim}{\MyTemp}}%
  837.     {\end{SaveVerbatim}%
  838.       \setlength{\fboxsep}{8pt}%
  839.       \fbox{\begin{minipage}{5cm}\UseVerbatim{\MyTemp}
  840.         \end{minipage}}}
  841. \end{LVerbatim}
  842. Here are some verbatim commands for short-pieces of (in-line) verbatim text:
  843. \begin{description}
  844.   \vitem"\Verb<char> <literal> <char>" \ \\
  845.   Like \LaTeX's "\verb" command, but it will complain if it encounters a new
  846. line in <literal>.\footnote{Be careful that your word processing does not
  847. insert one for you.} For example:
  848. \begin{example*}
  849.   "\begin{quote}
  850.   The main use for the \Verb+SaveVerbatim+
  851.   environment and the \Verb+\UseVerbatim+
  852.   commands is to include $\ldots$
  853.   "\end{quote}
  854. \end{example*}
  855.   \vitem"\UseVerb{<cmd>}" Like "\UseVerbatim", but without any particular
  856. formatting. It is intended for including short pieces of literal text saved
  857. with "\SaveVerb" (below).\footnote{But it can also be used for multiple lines
  858. saved with the "SaveVerbatim" environment if you want to do the formatting
  859. yourself. E.g., try this in a tabbing environment with "\VerbatimTab"
  860. appropriately defined.}
  861.   \vitem"\SaveVerb[<whatever>]{<cmd>}<char> <literal> <char>"\ \\
  862.   This is like "\Verb", but it saves <literal> as <cmd>, and then returns to
  863. the optional argument <whatever>. Like the "SaveVerbatim" environment, it
  864. defines <cmd> globally without checking whether <cmd> is already defined.
  865. Without the optional argument, the most common use is for including verbatim
  866. text in a "\marginpar", "\section" or other command argument.
  867.   The optional argument can be used for special tricks. For example, all the
  868. listings of commands in this documentation use "\vitem" in a "description"
  869. environment, where "\vitem" is defined by:\footnote{The braces enclosing the
  870. optional argument of "\SaveVerb" prevent the "]" inside the argument from
  871. being mistaken for the end of the argument.}
  872. \begin{LVerbatim}
  873.   \newcommand{\vitem}%
  874.     {\SaveVerb[{\item[\UseVerb{\MyTemp}]}]{\MyTemp}}
  875. \end{LVerbatim}
  876. Whereas
  877. \begin{LVerbatim}
  878.   \item[\Verb"\foo"]
  879. \end{LVerbatim}
  880. would not work because after "\item" reads its argument it is too late to
  881. interpret "\foo" literally,
  882. \begin{LVerbatim}
  883.   \vitem"foo"
  884. \end{LVerbatim}
  885. does work because it is equivalent to
  886. \begin{LVerbatim}
  887.   \SaveVerb{\MyTemp}"foo"\item[\UseVerb{\MyTemp}]
  888. \end{LVerbatim}
  889. \end{description}
  890. These environments and commands use various parameters that make it easy to
  891. customize their behavior. However, until you want to find the need for such
  892. customization, you might as well ignore the rest of this section.
  893. Internally, "fancybox.sty" separates the reading and formatting of verbatim
  894. text. Most of the environments and commands perform both functions, but
  895. "SaveVerbatim" and "\SaveVerb" only read the text, while "UseVerbatim" (and
  896. company) and "\UseVerb" only format the text. "VerbatimOut" gets special
  897. treatment. The parameters that apply to each class of verbatim environment or
  898. command is listed in Table \ref{verbtable}.
  899. \begin{table}
  900. \begin{center}
  901. \renewcommand{\arraystretch}{0}
  902. \setlength{\tabcolsep}{7pt}
  903. \newcommand{\vs}{& \\[\tabcolsep]}
  904. \newcommand{\VS}{\\ \vs \hline \vs}
  905. \begin{tabular}{|l|l|}
  906. \hline \vs
  907. {\em Where} & {\em What}
  908. \\ \vs \hline
  909. \hline \vs
  910.   \begin{Bflushleft}
  911.     Environments\\
  912.     that format
  913.   \end{Bflushleft}
  914.   \begin{Bflushleft}
  915.     "\VerbatimSpace"\\
  916.     "\VerbatimTab"\\
  917.     "\VerbatimFont"\\
  918.     "\VerbatimFuzz"\\
  919.     "\EveryVerbatimLine"\\
  920.     "\EveryVerbatim"\\
  921.     "\ThisVerb"
  922.   \end{Bflushleft}
  923.   \begin{Bflushleft}
  924.     Environments\\
  925.     that read
  926.   \end{Bflushleft}
  927.   \begin{Bflushleft}
  928.     "\EveryVerbatimCodes"\\
  929.     "\ThisVerbCodes"
  930.   \end{Bflushleft}
  931.   \begin{Bflushleft}
  932.     "\Verb" and\\
  933.     "\UseVerb"
  934.   \end{Bflushleft}
  935.   \begin{Bflushleft}
  936.     "\VerbSpace"\\
  937.     "\VerbTab"\\
  938.     "\VerbFont"\\
  939.     "\EveryVerb"\\
  940.     "\ThisVerb"
  941.   \end{Bflushleft}
  942.   \begin{Bflushleft}
  943.     "\Verb" and\\
  944.     "\SaveVerb"
  945.   \end{Bflushleft}
  946.   \begin{Bflushleft}
  947.     "\EveryVerbCodes"\\
  948.     "\ThisVerbCodes"
  949.   \end{Bflushleft}
  950.   \begin{Bflushleft}
  951.     "VerbatimOut"
  952.   \end{Bflushleft}
  953.   \begin{Bflushleft}
  954.     "\EveryVerbOutCodes"\\
  955.     "\ThisVerbCodes"\\
  956.     "\EveryVerbOutLine"\\
  957.     "\ThisVerb"
  958.   \end{Bflushleft}
  959. \\ \vs \hline
  960. \end{tabular}
  961. \caption{Parameters for the verbatim environments and
  962. commands.\label{verbtable}}
  963. \end{center}
  964. \end{table}
  965. All the parameters, including "\VerbatimFuzz", are ordinary commands, and
  966. should be changed with "\renewcommand".
  967. Here is a description of each of the parameters for environments that format
  968. the verbatim text:
  969. \begin{description}
  970.   \vitem"\VerbatimSpace" The insertion text for spaces. The default is "\ ",
  971. which produces a blank space. Change it to "\ttspace" to get \ttspace.
  972.   \vitem"\VerbatimTab" The insertion text for tabs. The default is
  973. \begin{LVerbatim}
  974.   \ \ \ \ \ \ \ \
  975. \end{LVerbatim}
  976.   \vitem"\VerbatimFont" The font to use for verbatim text. The default is
  977. "\tt"
  978.   \vitem"\VerbatimFuzz" This is the amount by which lines can be too long in a
  979. "Verbatim" or "LVerbatim" environment before you get overfull "\hbox"
  980. warnings. This threshold is usually .1pt, but the default definition of
  981. "\VerbatimFuzz" is "2pt" because verbatim lines won't break and are therefore
  982. often too long.
  983.   \vitem"\EveryVerbatimLine" This is inserted at the beginning of each line of
  984. verbatim environments or verbatim files. By default it does nothing. I like to
  985. indent each line in the verbatim environment in the input file by 2 spaces, so
  986. I define
  987. \begin{LVerbatim}
  988.   \renewcommand{\EveryVerbatimLine}[2]{}
  989. \end{LVerbatim}
  990. to eat those spaces. (But I have to remember to put in two spaces or space
  991. markers for blank lines too.) You might also use it to number the lines. For
  992. example:
  993. \begin{example}
  994.   \newcounter{VerbLineNo}
  995.   \renewcommand{\EveryVerbatimLine}%
  996.     {\makebox[10pt][r]{%
  997.        \stepcounter{VerbLineNo}%
  998.        \tiny\rm\arabic{VerbLineNo}}%
  999.     \hspace{10pt}}
  1000.   \renewcommand{\EveryVerbatim}%
  1001.     {\setcounter{VerbLineNo}{0}}
  1002.   \begin{SaveVerbatim}{\MyTemp}
  1003.   \setlength{\fboxsep}{15pt}
  1004.   \setlength{\mylength}{\linewidth}
  1005.   \end{SaveVerbatim}
  1006.   \fbox{\BUseVerbatim{\MyTemp}}
  1007. \end{example}
  1008.   \vitem"\EveryVerbatim" Whatever else you want to say before formatting the
  1009. verbatim text. By default, it does nothing.
  1010.   \vitem"\ThisVerb" This is executed before any of the commands above, and
  1011. then its value is cleared. Use this to customize a single verbatim formatting
  1012. environment.
  1013. \end{description}
  1014. Here is a description of the parameters for environments that read the
  1015. verbatim text:
  1016. \begin{description}
  1017.   \vitem"\EveryVerbatimCodes" This command is inserted just before reading the
  1018. verbatim text. Use it to play with "\catcode"'s (see the {\em \TeX book}). For
  1019. example, I might type
  1020. \begin{LVerbatim}
  1021.   \renewcommand{\EveryVerbatimCodes}{\catcode`\"=14}
  1022. \end{LVerbatim}
  1023. if I want to use \Verb+"+ as a comment character in verbatim text.%
  1024. %% The use of SaveVerbatim and \SaveVerb is not necessary here because
  1025. %% \VerbatimFootnotes is in effect. This is just a test.
  1026. \begin{SaveVerbatim}{\MyTemp}
  1027.   \def\MyQuote{"}    % \MyQuote is now the character ",
  1028.   \def\temp{\Verb"}  %    in case I need it.
  1029.   \catcode`\"=13     % Now " is like a command.
  1030.   \let"\temp         % Now "foo" is like \Verb"foo"
  1031.   \def\do{\noexpand\do\noexpand}      % Now " can be used in verbatim
  1032.   \edef\dospecials{\dospecials\do\"}  % environments anyway.
  1033. \end{SaveVerbatim}\SaveVerb{\Foo}+"+\SaveVerb{\FFoo}+\Verb"foo"+%
  1034. \footnote{Here is another "\catcode" trick. We make \UseVerb{\Foo} a short
  1035. verbatim command, so that we can say \UseVerb{\Foo foo\Foo} instead of
  1036. \UseVerb{\FFoo}:
  1037. \LUseVerbatim{\MyTemp}}
  1038.   \vitem"\ThisVerbCodes" This command is executed before "\EveryVerbCodes",
  1039. and then it is cleared. Use this to fool with the "\catcode"`s of a single
  1040. verbatim environment.
  1041. \end{description}
  1042. The parameters for "\Verb", "\UseVerb" and "\SaveVerb" and the "VerbatimOut"
  1043. environment are analogous to the similar commands for other environments.
  1044. Here is an example of the use of "\ThisVerb" to define a variant of "\Verb"
  1045. that uses \ttspace\ to mark spaces:
  1046. \begin{LVerbatim}
  1047.   \newcommand{\SVerb}{%
  1048.     \renewcommand{\ThisVerb}%
  1049.       {\renewcommand{\VerbatimSpace}{\ttspace}}%
  1050.     \Verb}
  1051. \end{LVerbatim}
  1052. Finally, without further comment, here are the definitions of the "example"
  1053. and "example*" environments that were used for the examples in this document:
  1054. {\renewcommand{\EveryVerbatimLine}{}\LVerbatimInput{\jobname.ex1}}
  1055. \section{Changes}
  1056. \raggedright
  1057. \paragraph*{Version 0.9, November 23, 1992} First release.
  1058. \paragraph*{Version 0.91, November 25, 1992}
  1059. \begin{enumerate}
  1060.   \item "\shadowsize" is now a length, to be set with "\setlength" or
  1061. "\addtolength".
  1062.   \item "\fancypage" split into "\fancypage" and "\fancyput"
  1063. \end{enumerate}
  1064. \paragraph*{Version 0.92, December 20, 1992}
  1065. \begin{enumerate}
  1066.   \item New "\boxput" command for superimposing boxes.
  1067.   \item New "\VerbatimFootnotes" command.
  1068.   \item New "\VerbBox" command for verbatim boxes.
  1069.   \item New "Sbox" environment. Makes "\beginsbox" and "\endsbox"
  1070.     obsolete, but the latter have been retained for compatibility.
  1071. \end{enumerate}
  1072. \paragraph{Version 0.93, January 20, 1993}
  1073. \begin{enumerate}
  1074.   \item New "\EndVerbatimTokens" for tokens that precede "\end{Verbatim}".
  1075.   \item New "\AltGetVerbatim", to allow any tokens to precede
  1076. "\end{Verbatim}".
  1077.   \item Fixed bug in "\BVerbatimInput" that caused second line to be repeated.
  1078.   \item New "LandScape" environment, for rotating pages without rotating
  1079. headers and footers.
  1080.   \item Slide frames "Oval", "oval", "shadow" and "double" are defined when
  1081. "seminar.sty" v0.93 (and maybe later) is loaded.
  1082. \end{enumerate}
  1083. \paragraph{Version 1.0, February 10, 1993}
  1084. \begin{enumerate}
  1085.   \item Fixed bugs in "\boxput".
  1086.   \item New "Beqnarray" environment.
  1087. \end{enumerate}
  1088. \end{document}
  1089. %% END fancybox.doc
  1090.